package main
import(
	"fmt"
	"time"
	"sync"
)

func main() {
	abc := make(chan int, 1000)	
	wait := sync.WaitGroup{}
	wait.Add(1)
	for i := 0; i < 10; i++ {
		abc <- i
	}
	go func(ptrWait *sync.WaitGroup) {
		time.Sleep(time.Second * 10)

		i :=0;
		for  a := range abc  {
			fmt.Println("a: ", a)
			if(i >=9){
				ptrWait.Done()
			}

			i +=1
		}
	}(&wait)

	wait.Wait()
	
	close(abc)
	fmt.Println("close")
	time.Sleep(time.Second * 100)

	var iTmp int
	fmt.Printf("iTmp=%v\n", iTmp)
}

 
 

 
